{extend name="property/public/insidePageBase" /}
{block name="title"}应用配置{/block}
{block name="body"}
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-form layui-form-pane">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">微信</li>
                    <li>能耗系统</li>
                    <li>E签宝电子合同</li>
                    <li>通通锁</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                            <legend>小程序配置</legend>
                        </fieldset>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label required">小程序版本</label>
                            <div class="layui-input-block">
                                <input type="radio" name="wechat[mini][env]" value="develop" title="开发版" {if isset($info['wechat']['mini']['env']) && $info['wechat']['mini']['env'] == 'develop'}checked{/if} />
                                <input type="radio" name="wechat[mini][env]" value="trial" title="体验版" {if isset($info['wechat']['mini']['env']) && $info['wechat']['mini']['env'] == 'trial'}checked{/if} />
                                <input type="radio" name="wechat[mini][env]" value="release" title="正式版" {if isset($info['wechat']['mini']['env']) && $info['wechat']['mini']['env'] == 'release'}checked{/if} />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label required">AppID</label>
                            <div class="layui-input-block">
                                <input type="text" name="wechat[mini][app_id]" value="{$info['wechat']['mini']['app_id'] ?? ''}" placeholder="请输入小程序ID" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label required">AppSecret</label>
                            <div class="layui-input-block">
                                <input type="text" name="wechat[mini][secret]" value="{$info['wechat']['mini']['secret'] ?? ''}" placeholder="请输入小程序密钥"  class="layui-input">
                            </div>
                        </div>
                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                            <legend>公众号配置</legend>
                        </fieldset>
                        <div class="layui-form-item">
                            <label class="layui-form-label required">AppID</label>
                            <div class="layui-input-block">
                                <input type="text" name="wechat[gzh][app_id]" value="{$info['wechat']['gzh']['app_id'] ?? ''}" placeholder="请输入公众号应用ID" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label required">AppSecret</label>
                            <div class="layui-input-block">
                                <input type="text" name="wechat[gzh][secret]" value="{$info['wechat']['gzh']['secret'] ?? ''}" placeholder="请输入公众号应用密钥"  class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-form-item">
                            <label class="layui-form-label required">AppID</label>
                            <div class="layui-input-block">
                                <input type="text" name="energy[appid]" value="{$info['energy']['appid'] ?? ''}" placeholder="请输入应用ID" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label required">AppSecret</label>
                            <div class="layui-input-block">
                                <input type="text" name="energy[app_secret]" value="{$info['energy']['app_secret'] ?? ''}" placeholder="请输入应用密钥"  class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label required">环境</label>
                            <div class="layui-input-block">
                                <input type="radio" name="esign[debug]" value="0" title="正式环境" {if isset($info['esign']['debug']) && $info['esign']['debug'] == 0}checked{/if} />
                                <input type="radio" name="esign[debug]" value="1" title="测试环境" {if isset($info['esign']['debug']) && $info['esign']['debug'] == 1}checked{/if} />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label required">AppID</label>
                            <div class="layui-input-block">
                                <input type="text" name="esign[appid]" value="{$info['esign']['appid'] ?? ''}" placeholder="请输入E签宝APPID" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label required">Secret</label>
                            <div class="layui-input-block">
                                <input type="text" name="esign[secret]" value="{$info['esign']['secret'] ?? ''}" placeholder="请输入E签宝密钥"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label required">回调地址</label>
                            <div class="layui-input-block">
                                <input type="text" name="esign[notify_url]" value="{$info['esign']['notify_url'] ?? ''}" placeholder="请输入回调地址"  class="layui-input">
                                <div class="layui-form-mid layui-word-aux">回调地址: {:request()->domain()}/esign/notify</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-form-item">
                            <label class="layui-form-label required">回调地址</label>
                            <div class="layui-input-block">
                                <input type="text" name="ttlock[notify_url]" value="{$info['ttlock']['notify_url'] ?? ''}" placeholder="请输入回调地址"  class="layui-input">
                                <div class="layui-form-mid layui-word-aux">
                                    <p>url: {:request()->domain()}/ttlock/unlockNotify</p>
                                    <p>用于接收开锁记录，当锁有连接网关时，开放平台会实时推送开锁记录到该地址。</p>
                                    <p>配置地址: <a href="https://cnopen.ttlock.com/manager" target="_blank">https://cnopen.ttlock.com/manager</a></p>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label required">clientId</label>
                            <div class="layui-input-block">
                                <input type="text" name="ttlock[client_id]" value="{$info['ttlock']['client_id'] ?? ''}" placeholder="请输入clientId" class="layui-input">
                                <div class="layui-form-mid layui-word-aux">在通通锁开放平台<a href="https://cnopen.ttlock.com/manager" target="_blank">创建应用</a>分配的clientId</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label required">clientSecret</label>
                            <div class="layui-input-block">
                                <input type="text" name="ttlock[client_secret]" value="{$info['ttlock']['client_secret'] ?? ''}" placeholder="请输入clientSecret"  class="layui-input">
                                <div class="layui-form-mid layui-word-aux">在通通锁开放平台<a href="https://cnopen.ttlock.com/manager" target="_blank">创建应用</a>分配的clientSecret</div>
                            </div>
                        </div>
                    </div>
                </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="setting">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
{__block__}
<script>
    layui.use(['layer', 'form', 'upload'], function () {
        let form = layui.form,upload=layui.upload;
        form.on('submit(setting)', function (data) {
            var field = data.field;
            var loadAdd = layer.msg('提交中', {icon: 16, time: 0, shade: 0.1, offset: '15px'});
            $.post("{:url('propertyProgramInfoInfo')}", field, function (res) {
                layer.close(loadAdd);
                if (res.code === 0) {
                    layer.msg(res.msg, {icon: 6, offset: '15px'});
                } else {
                    layer.msg(res.msg, {icon: 5, offset: '15px'});
                }
            });
            return false;
        });

    });
</script>
{/block}
